#!/usr/bin/env python
# encoding: utf-8

from app.views.api import route_api
from  flask import request,jsonify,g
import requests,json,decimal

from app import db
from app.model import Supplier

from app.common.libs.Logging import logger
from app.common.libs.Helper import getFormatDate, stringToDatetime

from sqlalchemy import func

@route_api.route("/supplier/search",methods = [ "GET","POST" ])
def supplierSearch():
    resp = { 'code':20000,'msg':'操作成功~', 'data':{}}
    return jsonify( resp )

@route_api.route("/supplier/delete",methods = [ "GET","POST" ])
def supplierDelete():
    resp = { 'code':20000,'msg':'操作成功~', 'data':{}}
    return jsonify( resp )

@route_api.route("/supplier/edit",methods = [ "GET","POST" ])
def supplierEdit():
    resp = { 'code':20000,'msg':'操作成功~', 'data':{}}
    return jsonify( resp )

@route_api.route("/supplier/list",methods = [ "GET","POST" ])
def supplierList():
    resp = { 'code':20000,'msg':'操作成功~', 'data':{}}
    suppliers = [ {'name':s.name} for s in db.session.query(Supplier).all() ]
    resp['data'] = suppliers
    return jsonify( resp )


